import request from "./request";
const Req = new request()
export function list(page=0,limit=10){
    return Req.get({
        url:'/orderList',
        data:{
            page,
            limit
        }
    })
}
export function search(ordersn,tel,time){
    /**
     * 1. 只有订单号时 单独查询订单号就ok了
     * 2. 手机和时间三种情况 a.只有手机号 b.只有时间 c.两个都有
     */
    let data = {};
    if(ordersn){// 处理了1
        data.ordersn = ordersn
    }else{// 准备处理2
        let beginTiem = time[0];
        let endTiem = time[1];
        if (tel && beginTiem) {// 处理c情况
            data.tel  = tel
            data.beginTiem  = beginTiem
            data.endTiem  = endTiem
        }else if(tel){// 处理了a
            data.tel = tel;
        }else if(beginTiem){// 处理了b
            data.beginTiem  = beginTiem
            data.endTiem  = endTiem
        }
    }
    return Req.post({
        url:'/searchOrder',
        data:data
    })
}
export function remove(_id){
    return Req.post({
        url:'/orderRemove',
        data:{
            _id
        }
    })
}

export function send(_id,sendno){
    return Req.post({
        url:"/setSendNo",
        data:{
            _id,
            sendno
        }
    })
}